package com.lovi.myusercenter.common;

import java.io.Serializable;

/**
 * 返回统一结果工具类
 */
public class Result{
    /**
     * 成功
     * @param data
     * @param <T>
     * @return
     */
    public static <T> BaseResponse<T> success(T data){
        return new BaseResponse(0,data,"ok");
    }

    /**
     * 失败
     * @param errorCode
     * @param <T>
     * @return
     */
    public static <T> BaseResponse<T> fail(ErrorCode errorCode){
        return new BaseResponse(errorCode);
    }

    public static <T> BaseResponse<T> fail(int code ,String message){
        return new BaseResponse(code,message);
    }

    public static <T> BaseResponse<T> fail(int code ,String message,String description){
        return new BaseResponse(code,message,description);
    }



}
